﻿<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
	 <%
	 	//更换主题
	 	Object o = session.getAttribute("user");
	 	boolean flag = false;
	 	if (o != null) {
	 		flag = true;
	 	}
	 	String themeName = "default";
	 	Cookie cookies[] = request.getCookies();
	 	if (cookies != null && cookies.length > 0) {
	 		for (int i = 0; i < cookies.length; i++) {
	 			if ("themeName".equals(cookies[i].getName())) {
	 				themeName = cookies[i].getValue();
	 				application.setAttribute("themeName", themeName);
	 				break;
	 			}
	 		}
	 	}
	 %>
<html>
<head>
    <title>企业人力资源软件</title>
	<%@ include file="base/head.jsp"%>
	<link href="${ctx}/images/tax2.ico" rel="shortcut icon" />
	<script type="text/javascript" src="${ctx}/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="${ctx}/js/init.js"></script>
    <script type="text/javascript">    
        $(function() {
        	var f = <%=flag%>;
        	if(f == false){
        	window.location.href = "${ctx}/login.jsp";
        	}
        	$('#ith').combobox({
                  panelHeight:100,
                  onChange:function(newVal, oldVal){
                     var oldHref = $('#uiTheme').attr('href');
                     var newHref = oldHref.substring(0,oldHref.indexOf('themes')) + 'themes/' + newVal + '/easyui.css';
                     console.log(newHref);
                     $('#uiTheme').attr('href', newHref);
                     //设置cookie值，并设置7天有效时间
                     $.cookie('themeName', newVal, {
                         expires : 7
                     });
                  }
              });
        
            $('#pwdBtn').click(function() {            	
            	$('#pwdWnd').show();
                $('#pwdWnd').dialog({
                	iconCls:'icon-save',
                	title:'密码修改',
                	modal:true,
                	buttons: [{
						text:'确定',
						iconCls:'icon-ok',
						handler:function(){
							$('#pwdForm').form('submit',{  
							    success: function(data){   
							        if(data=='true'){  
							            $.messager.alert('友情提示','密码修改成功','info');  
							        }else{
							        	$.messager.alert('友情提示','密码修改失败','error'); 
							        } 
							        $('#pwdWnd').dialog('close');
							    }  
							});
						}
					},{
						text:'取消',
						iconCls:'icon-cancel',
						handler:function(){
							$('#pwdWnd').dialog('close');
						}
				}]
                });
            });

            $('#logoutBtn').click(function() {
                $.messager.confirm('系统提示', '您确定要退出本次登录吗?', function(r) {
                    if (r) {
                    	//$.post("${ctx}/msg/editMsg.action", "json");
                        location.href = '${ctx}/user/logout.action?method=1';
                    }
                });
            });
            
            
        });
        function msgshow(value){
   			$.post("${ctx}/msg/lock.action?count="+value, 
			function(data){
				console.log(data);
				if(data==true){
				 //alert('open')
					$('#msgShow').show();
					//using('dialog', function(){
						$('#msgShow').dialog({
							title:'我的消息',
							modal : true,
							top :80,
							width:600,
							height:450,
							closed : false,
							cache : false,
							maximizable : true,
							collapsible : false,
							minimizable : false,
							href : "${ctx}/msg/list.action",
							onBeforeClose : function(){
								$('#msgForm').form('submit');
							},
							buttons : [{
								text : '关闭',
								iconCls : 'icon-cancel',
								handler : function() {
									$('#msgShow').dialog('close');
								}
							}]
						});
					//});
				}else{
				}
			}, "json");
      }
      
      
       window.onload=function(){
        	setTimeout('msgshow(1)',30);
        };
      window.setInterval("msgshow(2)", 10*60*2);
    </script>

</head>
<body onselectstart="return false;" class="easyui-layout" style="overflow-y: hidden; "  fit="true"   scroll="no">
<!--判断浏览器-->
<noscript>
	<div style=" position:absolute; z-index:100000; height:2046px;top:0px;left:0px; width:100%; background:white; text-align:center;">
		<img src="images/noscript.gif" alt='抱歉，请开启脚本支持！' />
	</div>
</noscript>
<!--头部区域-->
	<div region="north" split="false" border="false" style="overflow: hidden; height: 66px;">
		<%@ include file="/base/top.jsp"%>
	</div>
<!--菜单区域-->	
	<div region="west" split="true" title="导航菜单" style="width:180px;" id="west">
		<div id="wnav">
			<!--  手风琴导航内容 -->
		</div>
	</div>
<!--底部区域-->
    <div region="south" style="height:35px"><form id="msgForm" method="post" enctype="multipart/form-data" action="${ctx}/msg/updateread.action" style="display: none;"></form>
        <table class="main_foot" width="100%" cellpadding="2" cellspacing="0" border="0" >
		    <tr>
		        <td valign="middle">
		         技术支持：<a href="" target="_blank" style="color: #0D5798;"></a>
		        </td>
		    </tr>
		</table>
    </div>
<!--主体区域-->
	<div id="mainPanle" region="center" style="background: #eee; overflow-y:hidden" border="false">
		<div id="tabs" class="easyui-tabs"  fit="true"  >
			<div title="首页" style="padding:20px;overflow:hidden;background:#FFFFFF url(${ctx}/images/home.png) no-repeat center;background-size: 80% 70%;" id="home">
			</div>
		</div>
	</div>
<!--修改密码窗口-->
    <div id="pwdWnd"  style="width: 280px; height: 180px; padding: 5px; background: #fafafa;display: none">
    	<form id="pwdForm" method="post" action="json/updatePwd.action">
                <table cellpadding=3>
                	<tr>
                        <td>原密码：</td>
                        <td><input id="ymm" name="oldPwd" class="easyui-validatebox" type="Password" data-options="required:true" validType="remote['${ctx}/json/checkPwd.action','oldPwd']" invalidMessage="原始密码错误,请重新输入"/></td>
                    </tr>
                    <tr>
                        <td>新密码：</td>
                        <td><input id="xmm" name="newPwd" class="easyui-validatebox" type="Password" data-options="required:true"/></td>
                    </tr>
                    <tr>
                        <td>确认密码：</td>
                        <td><input id="qrmm" class="easyui-validatebox" type="Password" data-options="required:true" validType="equals['#xmm']"/></td>
                    </tr>
                </table>
        </form>
    </div>
    <div id="msgShow" style="width: 800px;height: 500px; padding: 5px; background: #ffffff;display: none">
    </div>
    <div id="xxzsShow" style="resizable:true;display: none">
    </div>
</body>
</html>